
/**
 * This is a generated class and is not intended for modification.  
 */
package com.model.valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.styles.StyleValidator;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.model.valueObjects.VOPrice;
import mx.events.ValidationResultEvent;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;

use namespace model_internal;

[ExcludeClass]
internal class _VoQuotationPopupListEntityMetadata extends com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
    private static var emptyArray:Array = new Array();

    model_internal static var allProperties:Array = new Array("stamp_number", "quotation_serialnumber_fk", "pro_name", "price_per_unit", "sgd_listprice", "base_currency_detserialnumber_fk", "part_number", "pro_serialnumber_fk", "quotation_code", "pro_description", "isSelected", "pro_detserialnumber", "quot_detserialnumber", "pro_qty", "quot_serialnumber", "other_part_no", "price_list", "default_price");
    model_internal static var allAssociationProperties:Array = new Array();
    model_internal static var allRequiredProperties:Array = new Array("stamp_number", "quotation_serialnumber_fk", "pro_name", "price_per_unit", "sgd_listprice", "base_currency_detserialnumber_fk", "part_number", "pro_serialnumber_fk", "quotation_code", "pro_description", "isSelected", "pro_detserialnumber", "quot_detserialnumber", "pro_qty", "quot_serialnumber", "other_part_no", "price_list", "default_price");
    model_internal static var allAlwaysAvailableProperties:Array = new Array("stamp_number", "quotation_serialnumber_fk", "pro_name", "price_per_unit", "sgd_listprice", "base_currency_detserialnumber_fk", "part_number", "pro_serialnumber_fk", "quotation_code", "pro_description", "isSelected", "pro_detserialnumber", "quot_detserialnumber", "pro_qty", "quot_serialnumber", "other_part_no", "price_list", "default_price");
    model_internal static var guardedProperties:Array = new Array();
    model_internal static var dataProperties:Array = new Array("stamp_number", "quotation_serialnumber_fk", "pro_name", "price_per_unit", "sgd_listprice", "base_currency_detserialnumber_fk", "part_number", "pro_serialnumber_fk", "quotation_code", "pro_description", "isSelected", "pro_detserialnumber", "quot_detserialnumber", "pro_qty", "quot_serialnumber", "other_part_no", "price_list", "default_price");
    model_internal static var derivedProperties:Array = new Array();
    model_internal static var collectionProperties:Array = new Array("price_list");
    model_internal static var collectionBaseMap:Object;
    model_internal static var entityName:String = "VoQuotationPopupList";
    model_internal static var dependentsOnMap:Object;
    model_internal static var dependedOnServices:Array = new Array();

    
    model_internal var _stamp_numberIsValid:Boolean;
    model_internal var _stamp_numberValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _stamp_numberIsValidCacheInitialized:Boolean = false;
    model_internal var _stamp_numberValidationFailureMessages:Array;
    
    model_internal var _pro_nameIsValid:Boolean;
    model_internal var _pro_nameValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _pro_nameIsValidCacheInitialized:Boolean = false;
    model_internal var _pro_nameValidationFailureMessages:Array;
    
    model_internal var _part_numberIsValid:Boolean;
    model_internal var _part_numberValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _part_numberIsValidCacheInitialized:Boolean = false;
    model_internal var _part_numberValidationFailureMessages:Array;
    
    model_internal var _quotation_codeIsValid:Boolean;
    model_internal var _quotation_codeValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _quotation_codeIsValidCacheInitialized:Boolean = false;
    model_internal var _quotation_codeValidationFailureMessages:Array;
    
    model_internal var _pro_descriptionIsValid:Boolean;
    model_internal var _pro_descriptionValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _pro_descriptionIsValidCacheInitialized:Boolean = false;
    model_internal var _pro_descriptionValidationFailureMessages:Array;
    
    model_internal var _other_part_noIsValid:Boolean;
    model_internal var _other_part_noValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _other_part_noIsValidCacheInitialized:Boolean = false;
    model_internal var _other_part_noValidationFailureMessages:Array;
    
    model_internal var _price_listIsValid:Boolean;
    model_internal var _price_listValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _price_listIsValidCacheInitialized:Boolean = false;
    model_internal var _price_listValidationFailureMessages:Array;
    
    model_internal var _default_priceIsValid:Boolean;
    model_internal var _default_priceValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _default_priceIsValidCacheInitialized:Boolean = false;
    model_internal var _default_priceValidationFailureMessages:Array;

    model_internal var _instance:_Super_VoQuotationPopupList;
    model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new com.adobe.fiber.styles.Style();

    public function _VoQuotationPopupListEntityMetadata(value : _Super_VoQuotationPopupList)
    {
        // initialize property maps
        if (model_internal::dependentsOnMap == null)
        {
            // depenents map
            model_internal::dependentsOnMap = new Object();
            model_internal::dependentsOnMap["stamp_number"] = new Array();
            model_internal::dependentsOnMap["quotation_serialnumber_fk"] = new Array();
            model_internal::dependentsOnMap["pro_name"] = new Array();
            model_internal::dependentsOnMap["price_per_unit"] = new Array();
            model_internal::dependentsOnMap["sgd_listprice"] = new Array();
            model_internal::dependentsOnMap["base_currency_detserialnumber_fk"] = new Array();
            model_internal::dependentsOnMap["part_number"] = new Array();
            model_internal::dependentsOnMap["pro_serialnumber_fk"] = new Array();
            model_internal::dependentsOnMap["quotation_code"] = new Array();
            model_internal::dependentsOnMap["pro_description"] = new Array();
            model_internal::dependentsOnMap["isSelected"] = new Array();
            model_internal::dependentsOnMap["pro_detserialnumber"] = new Array();
            model_internal::dependentsOnMap["quot_detserialnumber"] = new Array();
            model_internal::dependentsOnMap["pro_qty"] = new Array();
            model_internal::dependentsOnMap["quot_serialnumber"] = new Array();
            model_internal::dependentsOnMap["other_part_no"] = new Array();
            model_internal::dependentsOnMap["price_list"] = new Array();
            model_internal::dependentsOnMap["default_price"] = new Array();

            // collection base map
            model_internal::collectionBaseMap = new Object()
            model_internal::collectionBaseMap["price_list"] = "com.model.valueObjects.VOPrice";
        }

        model_internal::_instance = value;
        model_internal::_stamp_numberValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForStamp_number);
        model_internal::_stamp_numberValidator.required = true;
        model_internal::_stamp_numberValidator.requiredFieldError = "stamp_number is required";
        //model_internal::_stamp_numberValidator.source = model_internal::_instance;
        //model_internal::_stamp_numberValidator.property = "stamp_number";
        model_internal::_pro_nameValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPro_name);
        model_internal::_pro_nameValidator.required = true;
        model_internal::_pro_nameValidator.requiredFieldError = "pro_name is required";
        //model_internal::_pro_nameValidator.source = model_internal::_instance;
        //model_internal::_pro_nameValidator.property = "pro_name";
        model_internal::_part_numberValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPart_number);
        model_internal::_part_numberValidator.required = true;
        model_internal::_part_numberValidator.requiredFieldError = "part_number is required";
        //model_internal::_part_numberValidator.source = model_internal::_instance;
        //model_internal::_part_numberValidator.property = "part_number";
        model_internal::_quotation_codeValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForQuotation_code);
        model_internal::_quotation_codeValidator.required = true;
        model_internal::_quotation_codeValidator.requiredFieldError = "quotation_code is required";
        //model_internal::_quotation_codeValidator.source = model_internal::_instance;
        //model_internal::_quotation_codeValidator.property = "quotation_code";
        model_internal::_pro_descriptionValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPro_description);
        model_internal::_pro_descriptionValidator.required = true;
        model_internal::_pro_descriptionValidator.requiredFieldError = "pro_description is required";
        //model_internal::_pro_descriptionValidator.source = model_internal::_instance;
        //model_internal::_pro_descriptionValidator.property = "pro_description";
        model_internal::_other_part_noValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForOther_part_no);
        model_internal::_other_part_noValidator.required = true;
        model_internal::_other_part_noValidator.requiredFieldError = "other_part_no is required";
        //model_internal::_other_part_noValidator.source = model_internal::_instance;
        //model_internal::_other_part_noValidator.property = "other_part_no";
        model_internal::_price_listValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPrice_list);
        model_internal::_price_listValidator.required = true;
        model_internal::_price_listValidator.requiredFieldError = "price_list is required";
        //model_internal::_price_listValidator.source = model_internal::_instance;
        //model_internal::_price_listValidator.property = "price_list";
        model_internal::_default_priceValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForDefault_price);
        model_internal::_default_priceValidator.required = true;
        model_internal::_default_priceValidator.requiredFieldError = "default_price is required";
        //model_internal::_default_priceValidator.source = model_internal::_instance;
        //model_internal::_default_priceValidator.property = "default_price";
    }

    override public function getEntityName():String
    {
        return model_internal::entityName;
    }

    override public function getProperties():Array
    {
        return model_internal::allProperties;
    }

    override public function getAssociationProperties():Array
    {
        return model_internal::allAssociationProperties;
    }

    override public function getRequiredProperties():Array
    {
         return model_internal::allRequiredProperties;   
    }

    override public function getDataProperties():Array
    {
        return model_internal::dataProperties;
    }

    override public function getGuardedProperties():Array
    {
        return model_internal::guardedProperties;
    }

    override public function getUnguardedProperties():Array
    {
        return model_internal::allAlwaysAvailableProperties;
    }

    override public function getDependants(propertyName:String):Array
    {
       if (model_internal::dataProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a data property of entity VoQuotationPopupList");  
            
       return model_internal::dependentsOnMap[propertyName] as Array;  
    }

    override public function getDependedOnServices():Array
    {
        return model_internal::dependedOnServices;
    }

    override public function getCollectionProperties():Array
    {
        return model_internal::collectionProperties;
    }

    override public function getCollectionBase(propertyName:String):String
    {
        if (model_internal::collectionProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a collection property of entity VoQuotationPopupList");  

        return model_internal::collectionBaseMap[propertyName];
    }

    override public function getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
    {
        return new com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
    }

    override public function getValue(propertyName:String):*
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity VoQuotationPopupList");
        }

        return model_internal::_instance[propertyName];
    }

    override public function setValue(propertyName:String, value:*):void
    {
        if (model_internal::dataProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " is not a data property of entity VoQuotationPopupList");
        }

        model_internal::_instance[propertyName] = value;
    }

    override public function getMappedByProperty(associationProperty:String):String
    {
        switch(associationProperty)
        {
            default:
            {
                return null;
            }
        }
    }

    override public function getPropertyLength(propertyName:String):int
    {
        switch(propertyName)
        {
            default:
            {
                return 0;
            }
        }
    }

    override public function isAvailable(propertyName:String):Boolean
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity VoQuotationPopupList");
        }

        if (model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
        {
            return true;
        }

        switch(propertyName)
        {
            default:
            {
                return true;
            }
        }
    }

    override public function getIdentityMap():Object
    {
        var returnMap:Object = new Object();

        return returnMap;
    }

    [Bindable(event="propertyChange")]
    override public function get invalidConstraints():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_invalidConstraints;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_invalidConstraints;        
        }
    }

    [Bindable(event="propertyChange")]
    override public function get validationFailureMessages():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
    }

    override public function getDependantInvalidConstraints(propertyName:String):Array
    {
        var dependants:Array = getDependants(propertyName);
        if (dependants.length == 0)
        {
            return emptyArray;
        }

        var currentlyInvalid:Array = invalidConstraints;
        if (currentlyInvalid.length == 0)
        {
            return emptyArray;
        }

        var filterFunc:Function = function(element:*, index:int, arr:Array):Boolean
        {
            return dependants.indexOf(element) > -1;
        }

        return currentlyInvalid.filter(filterFunc);
    }

    /**
     * isValid
     */
    [Bindable(event="propertyChange")] 
    public function get isValid() : Boolean
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_isValid;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_isValid;
        }
    }

    [Bindable(event="propertyChange")]
    public function get isStamp_numberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isQuotation_serialnumber_fkAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPro_nameAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPrice_per_unitAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isSgd_listpriceAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isBase_currency_detserialnumber_fkAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPart_numberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPro_serialnumber_fkAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isQuotation_codeAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPro_descriptionAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isIsSelectedAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPro_detserialnumberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isQuot_detserialnumberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPro_qtyAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isQuot_serialnumberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isOther_part_noAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPrice_listAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isDefault_priceAvailable():Boolean
    {
        return true;
    }


    /**
     * derived property recalculation
     */
    public function invalidateDependentOnStamp_number():void
    {
        if (model_internal::_stamp_numberIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfStamp_number = null;
            model_internal::calculateStamp_numberIsValid();
        }
    }
    public function invalidateDependentOnPro_name():void
    {
        if (model_internal::_pro_nameIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPro_name = null;
            model_internal::calculatePro_nameIsValid();
        }
    }
    public function invalidateDependentOnPart_number():void
    {
        if (model_internal::_part_numberIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPart_number = null;
            model_internal::calculatePart_numberIsValid();
        }
    }
    public function invalidateDependentOnQuotation_code():void
    {
        if (model_internal::_quotation_codeIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfQuotation_code = null;
            model_internal::calculateQuotation_codeIsValid();
        }
    }
    public function invalidateDependentOnPro_description():void
    {
        if (model_internal::_pro_descriptionIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPro_description = null;
            model_internal::calculatePro_descriptionIsValid();
        }
    }
    public function invalidateDependentOnOther_part_no():void
    {
        if (model_internal::_other_part_noIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfOther_part_no = null;
            model_internal::calculateOther_part_noIsValid();
        }
    }
    public function invalidateDependentOnPrice_list():void
    {
        if (model_internal::_price_listIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPrice_list = null;
            model_internal::calculatePrice_listIsValid();
        }
    }
    public function invalidateDependentOnDefault_price():void
    {
        if (model_internal::_default_priceIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfDefault_price = null;
            model_internal::calculateDefault_priceIsValid();
        }
    }

    model_internal function fireChangeEvent(propertyName:String, oldValue:Object, newValue:Object):void
    {
        this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, propertyName, oldValue, newValue));
    }

    [Bindable(event="propertyChange")]   
    public function get stamp_numberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get stamp_numberValidator() : StyleValidator
    {
        return model_internal::_stamp_numberValidator;
    }

    model_internal function set _stamp_numberIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_stamp_numberIsValid;         
        if (oldValue !== value)
        {
            model_internal::_stamp_numberIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "stamp_numberIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get stamp_numberIsValid():Boolean
    {
        if (!model_internal::_stamp_numberIsValidCacheInitialized)
        {
            model_internal::calculateStamp_numberIsValid();
        }

        return model_internal::_stamp_numberIsValid;
    }

    model_internal function calculateStamp_numberIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_stamp_numberValidator.validate(model_internal::_instance.stamp_number)
        model_internal::_stamp_numberIsValid_der = (valRes.results == null);
        model_internal::_stamp_numberIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::stamp_numberValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::stamp_numberValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get stamp_numberValidationFailureMessages():Array
    {
        if (model_internal::_stamp_numberValidationFailureMessages == null)
            model_internal::calculateStamp_numberIsValid();

        return _stamp_numberValidationFailureMessages;
    }

    model_internal function set stamp_numberValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_stamp_numberValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_stamp_numberValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "stamp_numberValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get quotation_serialnumber_fkStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get pro_nameStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get pro_nameValidator() : StyleValidator
    {
        return model_internal::_pro_nameValidator;
    }

    model_internal function set _pro_nameIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_pro_nameIsValid;         
        if (oldValue !== value)
        {
            model_internal::_pro_nameIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_nameIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get pro_nameIsValid():Boolean
    {
        if (!model_internal::_pro_nameIsValidCacheInitialized)
        {
            model_internal::calculatePro_nameIsValid();
        }

        return model_internal::_pro_nameIsValid;
    }

    model_internal function calculatePro_nameIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_pro_nameValidator.validate(model_internal::_instance.pro_name)
        model_internal::_pro_nameIsValid_der = (valRes.results == null);
        model_internal::_pro_nameIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::pro_nameValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::pro_nameValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get pro_nameValidationFailureMessages():Array
    {
        if (model_internal::_pro_nameValidationFailureMessages == null)
            model_internal::calculatePro_nameIsValid();

        return _pro_nameValidationFailureMessages;
    }

    model_internal function set pro_nameValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_pro_nameValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_pro_nameValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_nameValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get price_per_unitStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get sgd_listpriceStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get base_currency_detserialnumber_fkStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get part_numberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get part_numberValidator() : StyleValidator
    {
        return model_internal::_part_numberValidator;
    }

    model_internal function set _part_numberIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_part_numberIsValid;         
        if (oldValue !== value)
        {
            model_internal::_part_numberIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "part_numberIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get part_numberIsValid():Boolean
    {
        if (!model_internal::_part_numberIsValidCacheInitialized)
        {
            model_internal::calculatePart_numberIsValid();
        }

        return model_internal::_part_numberIsValid;
    }

    model_internal function calculatePart_numberIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_part_numberValidator.validate(model_internal::_instance.part_number)
        model_internal::_part_numberIsValid_der = (valRes.results == null);
        model_internal::_part_numberIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::part_numberValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::part_numberValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get part_numberValidationFailureMessages():Array
    {
        if (model_internal::_part_numberValidationFailureMessages == null)
            model_internal::calculatePart_numberIsValid();

        return _part_numberValidationFailureMessages;
    }

    model_internal function set part_numberValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_part_numberValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_part_numberValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "part_numberValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get pro_serialnumber_fkStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get quotation_codeStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get quotation_codeValidator() : StyleValidator
    {
        return model_internal::_quotation_codeValidator;
    }

    model_internal function set _quotation_codeIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_quotation_codeIsValid;         
        if (oldValue !== value)
        {
            model_internal::_quotation_codeIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "quotation_codeIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get quotation_codeIsValid():Boolean
    {
        if (!model_internal::_quotation_codeIsValidCacheInitialized)
        {
            model_internal::calculateQuotation_codeIsValid();
        }

        return model_internal::_quotation_codeIsValid;
    }

    model_internal function calculateQuotation_codeIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_quotation_codeValidator.validate(model_internal::_instance.quotation_code)
        model_internal::_quotation_codeIsValid_der = (valRes.results == null);
        model_internal::_quotation_codeIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::quotation_codeValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::quotation_codeValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get quotation_codeValidationFailureMessages():Array
    {
        if (model_internal::_quotation_codeValidationFailureMessages == null)
            model_internal::calculateQuotation_codeIsValid();

        return _quotation_codeValidationFailureMessages;
    }

    model_internal function set quotation_codeValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_quotation_codeValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_quotation_codeValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "quotation_codeValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get pro_descriptionStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get pro_descriptionValidator() : StyleValidator
    {
        return model_internal::_pro_descriptionValidator;
    }

    model_internal function set _pro_descriptionIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_pro_descriptionIsValid;         
        if (oldValue !== value)
        {
            model_internal::_pro_descriptionIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_descriptionIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get pro_descriptionIsValid():Boolean
    {
        if (!model_internal::_pro_descriptionIsValidCacheInitialized)
        {
            model_internal::calculatePro_descriptionIsValid();
        }

        return model_internal::_pro_descriptionIsValid;
    }

    model_internal function calculatePro_descriptionIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_pro_descriptionValidator.validate(model_internal::_instance.pro_description)
        model_internal::_pro_descriptionIsValid_der = (valRes.results == null);
        model_internal::_pro_descriptionIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::pro_descriptionValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::pro_descriptionValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get pro_descriptionValidationFailureMessages():Array
    {
        if (model_internal::_pro_descriptionValidationFailureMessages == null)
            model_internal::calculatePro_descriptionIsValid();

        return _pro_descriptionValidationFailureMessages;
    }

    model_internal function set pro_descriptionValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_pro_descriptionValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_pro_descriptionValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_descriptionValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get isSelectedStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get pro_detserialnumberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get quot_detserialnumberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get pro_qtyStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get quot_serialnumberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get other_part_noStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get other_part_noValidator() : StyleValidator
    {
        return model_internal::_other_part_noValidator;
    }

    model_internal function set _other_part_noIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_other_part_noIsValid;         
        if (oldValue !== value)
        {
            model_internal::_other_part_noIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "other_part_noIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get other_part_noIsValid():Boolean
    {
        if (!model_internal::_other_part_noIsValidCacheInitialized)
        {
            model_internal::calculateOther_part_noIsValid();
        }

        return model_internal::_other_part_noIsValid;
    }

    model_internal function calculateOther_part_noIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_other_part_noValidator.validate(model_internal::_instance.other_part_no)
        model_internal::_other_part_noIsValid_der = (valRes.results == null);
        model_internal::_other_part_noIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::other_part_noValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::other_part_noValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get other_part_noValidationFailureMessages():Array
    {
        if (model_internal::_other_part_noValidationFailureMessages == null)
            model_internal::calculateOther_part_noIsValid();

        return _other_part_noValidationFailureMessages;
    }

    model_internal function set other_part_noValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_other_part_noValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_other_part_noValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "other_part_noValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get price_listStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get price_listValidator() : StyleValidator
    {
        return model_internal::_price_listValidator;
    }

    model_internal function set _price_listIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_price_listIsValid;         
        if (oldValue !== value)
        {
            model_internal::_price_listIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "price_listIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get price_listIsValid():Boolean
    {
        if (!model_internal::_price_listIsValidCacheInitialized)
        {
            model_internal::calculatePrice_listIsValid();
        }

        return model_internal::_price_listIsValid;
    }

    model_internal function calculatePrice_listIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_price_listValidator.validate(model_internal::_instance.price_list)
        model_internal::_price_listIsValid_der = (valRes.results == null);
        model_internal::_price_listIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::price_listValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::price_listValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get price_listValidationFailureMessages():Array
    {
        if (model_internal::_price_listValidationFailureMessages == null)
            model_internal::calculatePrice_listIsValid();

        return _price_listValidationFailureMessages;
    }

    model_internal function set price_listValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_price_listValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_price_listValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "price_listValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get default_priceStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get default_priceValidator() : StyleValidator
    {
        return model_internal::_default_priceValidator;
    }

    model_internal function set _default_priceIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_default_priceIsValid;         
        if (oldValue !== value)
        {
            model_internal::_default_priceIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "default_priceIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get default_priceIsValid():Boolean
    {
        if (!model_internal::_default_priceIsValidCacheInitialized)
        {
            model_internal::calculateDefault_priceIsValid();
        }

        return model_internal::_default_priceIsValid;
    }

    model_internal function calculateDefault_priceIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_default_priceValidator.validate(model_internal::_instance.default_price)
        model_internal::_default_priceIsValid_der = (valRes.results == null);
        model_internal::_default_priceIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::default_priceValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::default_priceValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get default_priceValidationFailureMessages():Array
    {
        if (model_internal::_default_priceValidationFailureMessages == null)
            model_internal::calculateDefault_priceIsValid();

        return _default_priceValidationFailureMessages;
    }

    model_internal function set default_priceValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_default_priceValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_default_priceValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "default_priceValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }


     /**
     * 
     * @inheritDoc 
     */ 
     override public function getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
     {
         switch(propertyName)
         {
            default:
            {
                return null;
            }
         }
     }
     
     /**
     * 
     * @inheritDoc 
     *  
     */  
     override public function getPropertyValidationFailureMessages(propertyName:String):Array
     {
         switch(propertyName)
         {
            case("stamp_number"):
            {
                return stamp_numberValidationFailureMessages;
            }
            case("pro_name"):
            {
                return pro_nameValidationFailureMessages;
            }
            case("part_number"):
            {
                return part_numberValidationFailureMessages;
            }
            case("quotation_code"):
            {
                return quotation_codeValidationFailureMessages;
            }
            case("pro_description"):
            {
                return pro_descriptionValidationFailureMessages;
            }
            case("other_part_no"):
            {
                return other_part_noValidationFailureMessages;
            }
            case("price_list"):
            {
                return price_listValidationFailureMessages;
            }
            case("default_price"):
            {
                return default_priceValidationFailureMessages;
            }
            default:
            {
                return emptyArray;
            }
         }
     }

}

}
